import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '../public/css/reset.css'
import axios from 'axios'
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
//加载动画
import { Indicator } from 'mint-ui';
Vue.use(MintUI)
//请求拦截
axios.interceptors.request.use(config => {
  //加载动画
  Indicator.open()
  return config
}), error => {
  return Promise.reject(error)
}
//响应拦截
axios.interceptors.response.use(response => {
  Indicator.close()
  return response
}), error => {
  Indicator.close()
  return Promise.reject(error)
}

//axios
Vue.prototype.$axios = axios

//解决Uncaught (in promise) NavigationDuplicated
import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}

// 全局时间戳过滤器
Vue.filter('dateFormat', function (dt) {
  Date.prototype.toLocaleString = function () {
    return this.getFullYear() + "年" + (this.getMonth() + 1) + "月" + this.getDate() + "日 " + this.getHours() + "点" + this.getMinutes() + "分" + this.getSeconds() + "秒";
  };
  var date = new Date(dt)
  return date.toLocaleString()
})



new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
